﻿package mortal.game.view.guild.otherpanel
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.interfaces.*;

    public class GuildWelcomePanel extends GuildOtherBasePanel
    {
        private var _txtGuildName:GTextFiled;
        private var _txtGuildMaster:GTextFiled;
        private var _txtGuildLevel:GTextFiled;
        private var _txtGuildMembersNum:GTextFiled;
        private var _btnConfirm:GButton;
        private var _guildInfo:SMiniGuildInfo;
        private static var _instance:GuildWelcomePanel = null;

        public function GuildWelcomePanel(param1:ILayer = null)
        {
            super(param1);
            setSize(467, 327);
            title = "" + Language.getString(71264);
            return;
        }// end function

        override public function layoutUI() : void
        {
            UIFactory.gBitmap(ImagesConst.guildWelcomeBg, 13, 32, this);
            var _loc_1:* = GlobalStyle.textFormatItemWhite;
            _loc_1.size = 14;
            this._txtGuildMaster = UIFactory.gTextField("", 92, 256, 90, 26, this, _loc_1);
            this._txtGuildLevel = UIFactory.gTextField("", 280, 256, 90, 26, this, _loc_1);
            this._txtGuildMembersNum = UIFactory.gTextField("15/100", 404, 256, 90, 26, this, _loc_1);
            var _loc_2:* = GlobalStyle.textFormatItemGreen;
            _loc_2.size = 18;
            _loc_2.align = "center";
            this._txtGuildName = UIFactory.gTextField("", 180, 80, 130, 30, this, _loc_2);
            this._btnConfirm = UIFactory.gButton(Language.getString(60076), 208, 302, 67, 22, this);
            return;
        }// end function

        override public function onMouseClick(event:MouseEvent) : void
        {
            switch(event.target)
            {
                case this._btnConfirm:
                {
                    hide();
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function setData(param1:SMiniGuildInfo) : void
        {
            this._guildInfo = param1;
            this.update();
            return;
        }// end function

        override public function update() : void
        {
            if (!isLoadComplete)
            {
                return;
            }
            if (this._guildInfo == null)
            {
                return;
            }
            this._txtGuildName.text = this._guildInfo.guildName;
            this._txtGuildMaster.text = this._guildInfo.leaderName;
            this._txtGuildLevel.text = this._guildInfo.level + "" + Language.getString(71265);
            this._txtGuildMembersNum.text = this._guildInfo.playerNum + "/" + this._guildInfo.maxPlayerNum;
            return;
        }// end function

        public static function get instance() : GuildWelcomePanel
        {
            if (!_instance)
            {
                _instance = new GuildWelcomePanel;
            }
            return _instance;
        }// end function

    }
}
